home *** CD-ROM | disk | FTP | other *** search
/ Mission 3 / Mission 3.zip / Mission 3.iso / tools / facevalu / examples / zoomdemo / userwork.lst next >
File List  |  1998-03-29  |  5KB  |  138 lines

  1. '
  2. ' *** Routines written for the Zoom Wrinkle demo (commented): ***
  3. > PROCEDURE my_zoom(index&)
  4. LOCAL tree%,x&,y&,w&,h&,factor&
  5. ' first, find the adress of the tree:
  6. tree%=@xrsrc_gaddr(0,zoom_dialog&)
  7. ' then check the popup (zoomfactor) value & set the w/h and true factor accordingly:
  8. SELECT zoom_factor_var&  !the zoom factor popup value
  9. CASE 1  !zoom factor = 4
  10.   factor&=4
  11.   w&=64
  12.   h&=64
  13. CASE 2  !zoom factor = 8
  14.   factor&=8
  15.   w&=32
  16.   h&=32
  17. CASE 3  !zoom factor = 16
  18.   factor&=16
  19.   w&=16
  20.   h&=16
  21. ENDSELECT
  22. ' then get the placement of the "thumb":
  23. x&=OB_X(tree%,zoom_drag&)
  24. y&=OB_Y(tree%,zoom_drag&)
  25. ' zoom it:
  26. @mono_zoom(LPEEK(OB_SPEC(tree%,from_here&)),16,x&,y&,w&,h&,LPEEK(OB_SPEC(tree%,zoom_here&)),32,factor&)
  27. ' redraw if neccesary:
  28. IF index&<>-1
  29.   @rsc_ob_draw(index&,zoom_here&)
  30. ENDIF
  31. RETURN
  32. > PROCEDURE my_resize_thumb(index&)
  33. LOCAL tree%
  34. ' first, find the adress of the tree:
  35. tree%=@xrsrc_gaddr(0,zoom_dialog&)
  36. ' then check the popup (zoomfactor) value & set the size of the "thumb" (outline) accordingly:
  37. SELECT zoom_factor_var&  !the zoom factor popup value
  38. CASE 1  !zoom factor = 4
  39. OB_W(tree%,zoom_drag&)=64
  40. OB_H(tree%,zoom_drag&)=64
  41. CASE 2  !zoom factor = 8
  42. OB_W(tree%,zoom_drag&)=32
  43. OB_H(tree%,zoom_drag&)=32
  44. CASE 3  !zoom factor = 16
  45. OB_W(tree%,zoom_drag&)=16
  46. OB_H(tree%,zoom_drag&)=16
  47. ENDSELECT
  48. ' now make sure the "thumb" is contained within the drawing:
  49. OB_X(tree%,zoom_drag&)=MIN(OB_X(tree%,zoom_drag&),SUB(SUB(OB_W(tree%,from_here&),OB_W(tree%,zoom_drag&)),2))
  50. OB_Y(tree%,zoom_drag&)=MIN(OB_Y(tree%,zoom_drag&),SUB(SUB(OB_H(tree%,from_here&),OB_H(tree%,zoom_drag&)),2))
  51. ' redraw if neccesary:
  52. IF index&<>-1
  53. @rsc_ob_draw(index&,from_here&)
  54. ENDIF
  55. RETURN
  56. '
  57. ' *** Replace the two relevant FV-written "user_"-routines with these (commented): ***
  58. > PROCEDURE user_on_open
  59. '
  60. ' This procedure is called when the program is run, after the RSC is
  61. ' loaded and just before the main loop. You can open program windows,
  62. ' toolboxes etc. here, or  init things for your program like
  63. ' loading an *.INF or .DAT file.
  64. '
  65. ' If run as an accessory, this procedure is called EVERY TIME
  66. ' THE ACCESSORY IS OPENED. If you need to do anything just ONCE,
  67. ' like disable menu-entries spesific to PROGRAM execution, set a global
  68. ' flag here to avoid doing things EVERY time the accessory is opened.
  69. '
  70. ' ΩΩwsnippetΩΩ  - Wrinkle code: (don't change or delete this flag)
  71. ' ΩΩwsnippetΩΩ  - End of Wrinkle code: (don't change or delete this flag)
  72. '
  73. ' initialize the "thumb" and placement:
  74. @my_resize_thumb(-1)
  75. ' initialize the zoom:
  76. @my_zoom(-1)
  77. '
  78. '
  79. RETURN
  80. > PROCEDURE user_rsc_interact(index&,tree&,object&,mc&,sub_me&)
  81. '
  82. '  <index&> is the index of this window in window_array&(index&,x)
  83. '           If the object tree is the normal menu bar, <index&>=-1
  84. '   <tree&> is the object tree number
  85. ' <object&> is the object that was selected (clicked on OR shortcut)
  86. '     <mc&> is the number of clicks (1=normal/2=double clicked/1 if shortcut)
  87. ' <sub_me&> is the chosen menuitem in a popup menu
  88. '
  89. SELECT tree&
  90. '
  91. ' ------------------------------------------------------------------------
  92. '
  93. CASE menu&
  94. SELECT object&
  95. CASE about&
  96. ~@alert_standard(1,about_alert&,"")                 !just an about-alert
  97. CASE dialog_open&
  98. ~@win_open_dialog(-1,zoom_dialog&,-1)               !open the zoom dialog
  99. CASE dialog_close&
  100. @win_close(@find_handle_from_tree(zoom_dialog&))    !close the zoom dialog
  101. CASE demo_quit&
  102. exit_program!=TRUE
  103. ENDSELECT
  104. '
  105. ' ------------------------------------------------------------------------
  106. '
  107. CASE zoom_dialog&
  108. SELECT object&
  109. CASE zoom_drag&
  110. @my_zoom(index&)                                    !the "thumb" is moved, so update the zoom
  111. CASE zoom_close&
  112. @win_close(@find_handle_from_tree(zoom_dialog&))    !close the zoom dialog
  113. CASE zoom_factor&
  114. @my_resize_thumb(index&)                            !the zoom factor is changed, so resize
  115. @my_zoom(index&)                                    !the "thumb" & update the zoom
  116. CASE zoom_more&
  117. ~@win_open_dialog(-1,zoom_explain&,-1)              !open the explanation dialog
  118. ENDSELECT
  119. '
  120. '
  121. ' ------------------------------------------------------------------------
  122. '
  123. CASE zoom_explain&
  124. SELECT object&
  125. CASE explain_close&
  126. @win_close(@find_handle_from_tree(zoom_explain&))   !close the explanation dialog
  127. ENDSELECT
  128. '
  129. ' ------------------------------------------------------------------------
  130. '
  131. '
  132. ' ΩΩwsnippetΩΩ  - Wrinkle code: (don't change or delete this flag)
  133. ' ΩΩwsnippetΩΩ  - End of Wrinkle code: (don't change or delete this flag)
  134. '
  135. ENDSELECT
  136. RETURN
  137. '
  138.